/**
 * Created by lwk on 2019/1/23.
 */

/**
 * 判断参数是否不为空
 * @param obj
 * @returns {boolean}
 */
let isNotBlank = (obj) => {
  if (!obj) {
    return false
  }
  if (Object.prototype.toString.call(obj) === `[object String]` && obj.trim().length <= 0) {
    return false
  }
  if (Object.prototype.toString.call(obj) === `[object Array]` && obj.length <= 0) {
    return false
  }
  if (Object.prototype.toString.call(obj) === `[object Object]` && Object.keys(obj).length <= 0) {
    return false
  }
  return true
}

/**
 * 判断参数是否为空
 * @param obj
 * @returns {boolean}
 */
let isBlank = (obj) => {
  return !isNotBlank(obj)
}

export default {
  isNotBlank,
  isBlank
}
